<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
   <input type="text"><span></span>
</body>
<script>
 const ipt=document.querySelector("input")
 ipt.addEventListener("keyup",function(){
    let flag=this.value.match(/^[a-z]{3,6}$/g)  ///^[a - z]{ 3, 6}$/表示必须是3或4或5或6位字母
    console.log(flag,200);
   document.querySelector("span").innerHTML= flag?"正确":"错误"
 })
 
</script>
</html>